# Interface for categories and documents to be treated uniformly, following the Composite Pattern.
class AComposite < ActiveRecord::Base
    
    def name
		raise NotImplementedError.new("Operation '#{__method__}' not supported")
    end

    def description
		raise NotImplementedError.new("Operation '#{__method__}' not supported")
    end

    def children
		raise NotImplementedError.new("Operation '#{__method__}' not supported")
    end	
	
	# Returns the sorting options for categories and documents in the archie
	def self.sort_options
		[
			{ name: I18n.translate('content.sort_by.created_at_desc'), direction: 'desc', id: '#.created_at' },
			{ name: I18n.translate('content.sort_by.created_at_asc'), direction: 'asc', id: '#.created_at' },
			{ name: I18n.translate('content.sort_by.name_asc'), direction: 'asc', id: 'name' },
			{ name: I18n.translate('content.sort_by.name_desc'), direction: 'desc', id: 'name' },
			{ name: I18n.translate('content.sort_by.updated_at_desc'), direction: 'desc',id: '#.updated_at' },
			{ name: I18n.translate('content.sort_by.updated_at_asc'), direction: 'asc',id: '#.updated_at' }
		]
	end
	
end
